package com.yangli.ahies.study;




import java.text.SimpleDateFormat;
import java.util.*;

import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * @author ly
 * @description
 * @data 2021/11/4
 */
public class p {
    private int a;
    private String name;

    public int getA(){
        return a;
    }

    public void setA(int a){
        this.a = a;
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public static void printVariable(String... args) {
        String[] var1 = args;
        int var2 = args.length;

        for (int var3 = 0; var3 < var2; ++var3) {
            String s = var1[var3];
            System.out.println(s);
        }

    }

    public static void main(String[] args) {


/*
        Map map = Stream.of(p.builder().a(1).name("a").build(), p.builder().a(2).name("b").build(), p.builder().a(3).name("b").build())..collect(Collectors.groupingBy(p::getName, HashMap::new, Collectors.counting()));
*/
/*
        for (ProcessHandle ph : (Iterable<ProcessHandle>) ProcessHandle.allProcesses()::iterator) {
            // Process the process
        }*/
        p a = null;
        Long aLongp = Stream.of(a).mapToLong(p::getA).sum();
        System.out.println(aLongp);
        List<String> aa = List.of("a", "b", "c", "d");

      String [] bb =   aa.toArray(new String[0]);
     new ArrayList<>(Arrays.asList(bb));

    }

    private static final ThreadLocal<SimpleDateFormat> formatter = new ThreadLocal<SimpleDateFormat>(){
        @Override
        protected SimpleDateFormat initialValue(){
            return new SimpleDateFormat("yyyyMMdd HHmm");
        }
    };

/*        System.out.println(map);
        p.of(List.of("a", "b", "c", "d")).forEach(System.out::println
        );*/


    public static <E> Stream<List<E>> of(List<E> list) {
        return IntStream.range(0, list.size())
                .mapToObj(start -> IntStream.rangeClosed(start + 1, list.size())
                        .mapToObj(end -> list.subList(start, end)))
                .flatMap(x -> x);
    }
}
